@extends('layouts.default') @section('main')
    <link rel="stylesheet" href="/css/uniform.css" />
    <link rel="stylesheet" href="/css/select2.css" />
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i class="icon-home"></i> 首页</a>
                <a href="#" class="current">创客空间管理</a> </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    @if(in_array('add',$actions))<a href="{{url('maker/create')}}"><button class="btn">新增</button></a>@endif
                    <form action="{{url('maker/search')}}" method="post">
                        <table>
                            <tr>
                                <th>
                                    <label >空间名称 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <input type="text" class="span11" name="name"  placeholder="空间名称" />
                                    </div>
                                </th>
                                <th>
                                    <label >创始人昵称 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <input type="text" class="span11" name="nickname"  placeholder="创始人昵称" />
                                    </div>
                                </th>
                                <th>
                                    <label >是否门店 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <select  name="if_store" class="span11" >
                                            <option value="">请选择</option>
                                            <option value="1">门店</option>
                                            <option value="0">非门店</option>
                                        </select>
                                    </div>
                                </th>
                                <th>
                                    <label >是否推荐 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <select  name="recommend" class="span11" >
                                            <option value="">请选择</option>
                                            <option value="1">推荐</option>
                                            <option value="0">暂未推荐</option>
                                        </select>
                                    </div>
                                </th>
                                <th>
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <div class="controls">
                                        <button type="submit" class="btn btn-info">查询</button>
                                    </div>
                                </th>
                            </tr>
                        </table>
                    </form>
                    <div class="widget-box">
                        <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
                            <h5>创客空间管理</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <table class="table table-bordered ">
                                <thead>
                                <tr>
                                    <th>空间名称</th>
                                    <th>创始人昵称</th>
                                    <th>邮箱</th>
                                    <th>类型</th>
                                    <th>成员管理</th>
                                    <th>状态</th>
                                    <th>是否门店</th>
                                    <th>是否推荐</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($lists as $key => $list)
                                    <tr class="gradeX">
                                        <td>{{$list->name}}</td>
                                        <td>{{$list->nickname?$list->nickname:$list->realname}}</td>
                                        <td>{{$list->email}}</td>
                                        <td>@if($list->maker_type == 'qita')其他@elseif($list->maker_type == 'coffee')创客咖啡@elseif($list->maker_type == 'maker')创客空间@elseif($list->maker_type == 'fuhuaqi')孵化器@elseif($list->maker_type == 'media')科技媒体@elseif($list->maker_type == 'media')创客工场@endif</td>
                                        <td><a href="{{ url('maker/manage-members?id='.$list->id) }}">点击管理</a></td>
                                        <td>@if($list->status == 0)<i class="icon-question-sign"></i>@elseif($list->status == 1)<i class="icon-ok"></i>@elseif($list->status == -1)<i class="icon-remove"></i>@endif</td>
                                        <td>@if($list->if_store == 0)<i class="icon-remove"></i>@elseif($list->if_store == 1)<i class="icon-ok"></i>@endif</td>
                                        <td>@if($list->recommend == 0)<i class="icon-remove"></i>@elseif($list->recommend == 1)<i class="icon-thumbs-up"></i>@endif</td>
                                        <td class="center">
                                            @if(in_array('edit',$actions))<a data-original-title="编辑" class="tip" href="{{url('maker/edit?id='.$list->id)}}"><i class="icon-pencil"></i></a>@endif
                                            @if(in_array('delete',$actions))<a data-original-title="删除" data-toggle="modal" class="tip maker_delete" maker_id="{{$list->id}}" href="#myAlert"><i class="icon-remove"></i></a>@endif
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <?php echo $lists->render();?>
                </div>
            </div>
        </div>
    </div>
    <div>
        <div id="myAlert" class="modal hide">
            <div class="modal-header">
                <button data-dismiss="modal" class="close" type="button">×</button>
                <h3>提示</h3>
            </div>
            <div class="modal-body">
                <p>确认删除这条数据吗？</p>
            </div>
            <div class="modal-footer">
                <a data-dismiss="modal" class="btn btn-primary" href="javascript:void(0);">确定</a>
                <a data-dismiss="modal" class="btn" href="javascript:void(0);">取消</a>
            </div>
        </div>
        <form action="{{url('maker/delete')}}" method="post" id="adForm">
            <input type="hidden" name="mid" value="0">
        </form>
    </div>
    <script src="/js/common.js"></script>

    <script src="/js/matrix.tables.js"></script>
    <script>
        $(".maker_delete").click(function(){
            var maker_id = $(this).attr("maker_id");
            $("input[name='mid']").val(maker_id);
        });
        $(".btn-primary").click(function(){
            var maker_id = $("input[name='mid']").val();
            if(maker_id == 0){
                alert('参数异常');
                return;
            }
            ajaxRequest($('#adForm').serializeArray(),$('#adForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });
    </script>
@stop

